<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateTablePages extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function up()
    {
        $this->execute("CREATE TABLE `f_pages` (
            `id` int(11) NOT NULL AUTO_INCREMENT,
            `title` varchar(45) NOT NULL,
            `custom_path` varchar(45) DEFAULT NULL,
            `content` text,
            `images` text,
            `cover` text,
            `status` varchar(10) DEFAULT 'normal' COMMENT '状态',
            `create_time` int(11) DEFAULT NULL,
            `update_time` int(11) DEFAULT NULL,
            `comment` enum('allow','disallow') DEFAULT 'disallow' COMMENT '开关评论',
            PRIMARY KEY (`id`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='单页数据';
          
          ");
    }
    public function down()
    {
        $this->execute("drop table `f_pages`;");
    }
}
